package me.zy.entity;

import java.io.Serializable;

/**
 * Created by yuzhou on 2017/10/9.
 */
public class CartItem implements Serializable {

  private Product product;
  private Integer quantity;

  public CartItem(Product product, Integer quantity) {
    this.product = product;
    this.quantity = quantity;
  }

  public Integer getTotalPrice() {
    return this.quantity * this.product.getPrice();
  }

  public void increaseQuantity() {
    this.quantity++;
  }

  public Product getProduct() {
    return product;
  }

  public void setProduct(Product product) {
    this.product = product;
  }

  public Integer getQuantity() {
    return quantity;
  }

  public void setQuantity(Integer quantity) {
    this.quantity = quantity;
  }
}
